96b44e68c6ab615a6ad76f29280e19432636fb3e,core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java,ExploreByTouchHelper,createNodeForChild,#number#,792
Before Change
mTempVisibleRect.offset(mTempGlobalRect[0] - mHost.getScrollX(),
mTempGlobalRect[1] - mHost.getScrollY());
mTempScreenRect.intersect(mTempVisibleRect);
node.setBoundsInScreen(mTempScreenRect);
if (isVisibleToUser(mTempScreenRect)) {
node.setVisibleToUser(true);
After Change
*/
@NonNull
private AccessibilityNodeInfoCompat createNodeForChild(int virtualViewId) {
final AccessibilityNodeInfoCompat node = AccessibilityNodeInfoCompat.obtain();
// Ensure the client has good defaults.
node.setEnabled(true);
node.setFocusable(true);
node.setClassName(DEFAULT_CLASS_NAME);
node.setBoundsInParent(INVALID_PARENT_BOUNDS);
node.setBoundsInScreen(INVALID_PARENT_BOUNDS);
node.setParent(mHost);
// Allow the client to populate the node.
onPopulateNodeForVirtualView(virtualViewId, node);
// Make sure the developer is following the rules.
if ((node.getText() == null) && (node.getContentDescription() == null)) {
throw new RuntimeException("Callbacks must add text or a content description in "
+ "populateNodeForVirtualViewId()");
}
node.getBoundsInParent(mTempParentRect);
if (mTempParentRect.equals(INVALID_PARENT_BOUNDS)) {
throw new RuntimeException("Callbacks must set parent bounds in "
+ "populateNodeForVirtualViewId()");
}
final int actions = node.getActions();
if ((actions & AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS) != 0) {
throw new RuntimeException("Callbacks must not add ACTION_ACCESSIBILITY_FOCUS in "
+ "populateNodeForVirtualViewId()");
}
if ((actions & AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) {
throw new RuntimeException("Callbacks must not add ACTION_CLEAR_ACCESSIBILITY_FOCUS in "
+ "populateNodeForVirtualViewId()");
}
// Don't allow the client to override these properties.
node.setPackageName(mHost.getContext().getPackageName());
node.setSource(mHost, virtualViewId);
// Manage internal accessibility focus state.
if (mAccessibilityFocusedVirtualViewId == virtualViewId) {
node.setAccessibilityFocused(true);
node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
} else {
node.setAccessibilityFocused(false);
node.addAction(AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS);
}
// Manage internal keyboard focus state.
final boolean isFocused = mKeyboardFocusedVirtualViewId == virtualViewId;
if (isFocused) {
node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_FOCUS);
} else if (node.isFocusable()) {
node.addAction(AccessibilityNodeInfoCompat.ACTION_FOCUS);
}
node.setFocused(isFocused);
// Set the visibility based on the parent bound.
if (intersectVisibleToUser(mTempParentRect)) {
node.setVisibleToUser(true);
node.setBoundsInParent(mTempParentRect);
}
// If not explicitly specified, calculate screen-relative bounds and
// offset for scroll position based on bounds in parent.
node.getBoundsInScreen(mTempScreenRect);
if (mTempScreenRect.equals(INVALID_PARENT_BOUNDS)) {
mHost.getLocationOnScreen(mTempGlobalRect);
node.getBoundsInParent(mTempScreenRect);
mTempScreenRect.offset(mTempGlobalRect[0] - mHost.getScrollX(),
mTempGlobalRect[1] - mHost.getScrollY());
node.setBoundsInScreen(mTempScreenRect);
}
return node;